﻿package com.dg.gaming.api.common.playerstate{

	/**
	 * ...
	 * @author 
	 */
	public class PlayerStateFactory {
		/**
		 * Factory method which returns a PlayerState object from a specied
		 * integer state.
		 *
		 * @param state       State as an string.
		 * @return            State as a PlayerState object.
		 */
		public static function getState(state:String):PlayerState {

			if (state==PlayerState.VIEWING) {
				return new PlayerStateViewing  ;
			} else if (state==PlayerState.SEATED) {
				return new PlayerStateSeated  ;
			} else if (state==PlayerState.READY_TO_START) {
				return new PlayerStateReady  ;
			} else if (state==PlayerState.GAME_STARTED) {
				return new PlayerStateGameStarted  ;
			}

			return null;
		}

	}

}